<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGoodsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('goods', function(Blueprint $table)
		{
			$table->increments('id');

			// 产品名称
			$table->string('name')->comment('产品名称');

			// 产品介绍
			$table->text('details')->comment('产品详情');

			// 产品封面
			$table->char('cover_id',18)->comment('封面');

			// 产品原价
			$table->float('original_price')->comment('产品原价');

			// 产品现价
			$table->float('present_price')->comment('产品现价');

			// 排序
			$table->integer('sort_at')->default(1)->comment('排序');

			// 状态
			$table->tinyInteger('status')->default(1)->comment('状态');

			// 折扣开始时间
			$table->timestamp('discount_star_at')->nullable()->comment('折扣开始时间');

			// 折扣结束时间
			$table->timestamp('discount_end_at')->nullable()->comment('折扣结束时间');

			$table->timestamps();
			$table->softDeletes();
			$table->index('deleted_at');
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('goods');
	}

}
